﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Housing;

public partial class PublicContent_PersonalInfor : System.Web.UI.Page
{
    Users user = new Users();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["UserId"] != null)
            {
                user.GetUserByUserId(Convert.ToInt32(Session["UserId"].ToString()));
                if (user.UserName!=null)
                {
                    lblusername.Text = user.UserName;
                    if (Session["UserStreet"].ToString() != "海曙")
                        lblusertype.Text = user.UserType + "(" + Session["UserStreet"].ToString() + ")";
                    else
                        lblusertype.Text = user.UserType;
                    txbsignature.Text = user.Signature;
                }
            }
            else
                WebHelper.AlertAndRedirect("登陆超时，请重新登陆","../Login.aspx");
        }
    }
    protected void btnupdate_Click(object sender, EventArgs e)
    {
        user.GetUserByUserName(lblusername.Text);
        user.Signature = txbsignature.Text;
        bool succ = user.UpdateAUser(user);
        if (succ)
            WebHelper.Alert("信息修改成功！");
        else
            WebHelper.Alert("修改未成功，请重新修改");

    }
}
